package com.songhuan.web.controller;
import com.songhuan.web.dto.*;
import com.songhuan.web.dto.query.*;
import com.songhuan.web.entity.*;
import com.songhuan.web.mapper.*;
import com.songhuan.web.service.*;
import com.songhuan.web.tools.dto.*;
import com.songhuan.web.dto.LineUploadDto;
import com.songhuan.web.dto.query.LineUploadPagedInput;
import com.songhuan.web.mapper.LineUploadMapper;
import com.songhuan.web.service.LineUploadService;
import com.songhuan.web.tools.dto.IdInput;
import com.songhuan.web.tools.dto.IdsInput;
import com.songhuan.web.tools.dto.PagedResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import lombok.SneakyThrows;

/**
 * 线路实时上报控制器
 */
@RestController()
@RequestMapping("/LineUpload")
public class LineUploadController {
    @Autowired()
    private LineUploadService _LineUploadService;
    @Autowired()
    private LineUploadMapper _LineUploadMapper;
    /**
     * 线路实时上报分页查询
     */
    @RequestMapping(value = "/List", method = RequestMethod.POST)
    @SneakyThrows
    public PagedResult<LineUploadDto> List(@RequestBody LineUploadPagedInput input)  {
        return _LineUploadService.List(input);
    }
     /**
     * 单个线路实时上报查询接口
     */
    @RequestMapping(value = "/Get", method = RequestMethod.POST)
    @SneakyThrows
    public LineUploadDto Get(@RequestBody LineUploadPagedInput input) {

        return _LineUploadService.Get(input);
    }
  
    /**
     * 线路实时上报创建或则修改
     */
    @RequestMapping(value = "/CreateOrEdit", method = RequestMethod.POST)
    public LineUploadDto CreateOrEdit(@RequestBody LineUploadDto input) throws Exception {
        return _LineUploadService.CreateOrEdit(input);
    }
    /**
     * 线路实时上报删除
     */
    @RequestMapping(value = "/Delete", method = RequestMethod.POST)
    public void Delete(@RequestBody IdInput input)
    {
        _LineUploadService.removeById(input.getId());
    }

    /**
     * 线路实时上报批量删除
     */
    @RequestMapping(value = "/BatchDelete", method = RequestMethod.POST)
    public void BatchDelete(@RequestBody IdsInput input)
    {
        _LineUploadService.removeByIds(input.getIds());
    }

    /**
     * 每隔10s上报一次最新的用户数据
     */
    @RequestMapping(value = "/SyncLocation", method = RequestMethod.POST)
    public void SyncLocation(@RequestBody LineUploadDto input) {

        _LineUploadService.SyncLocation(input);
    }
}
